<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <p>￥<span id="span1"> 340</span>
       </p>
<div>
    <input type="button" value="-" id="btn1">
  <input type="text" id="money" value="0">
    <input type="button" value="+" id="btn2">
</div>
    <p>￥总价：<span id="span2">0</span></p>

    <script>
        var n=0;
        btn1.onclick=function(){
            if(n<1){
                return
            }
            n--
            money.value=n
            span2.innerHTML=n*span1.innerHTML
        }
        btn2.onclick=function(){
            n++
            money.value=n
            span2.innerHTML=n*span1.innerHTML
        }
        money.oninput=function(){
            n=money.value
            console.log(money)
            span2.innerHTML=n*span1.innerHTML
        }
    </script>


</body>
</html>